package com.cartel.genius.services;

import java.util.List;

import com.cartel.genius.dao.exceptions.CategoryNotFoundException;
import com.cartel.genius.dao.exceptions.PlaceExistsException;
import com.cartel.genius.dao.exceptions.PlaceNotFoundException;
import com.cartel.genius.dao.exceptions.PlaceParentNotFoundException;
import com.cartel.genius.dto.PlaceTO;

/**
 * Service class for Place operations
 * 
 * @author Naresh Reddy
 */
public interface PlaceService {
	
	/**
	 * Method to add root place. All other places will be childs of this place
	 * 
	 * @param placeCode
	 * @param placeName
	 * @param categoryName
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws CategoryNotFoundException
	 */
	public PlaceTO addRootPlace(String placeCode, String placeName, String categoryName) throws PlaceExistsException, CategoryNotFoundException;
	
	/**
	 * Method to add root place. All other places will be childs of this place
	 * 
	 * @param placeCode
	 * @param placeName
	 * @param categoryId
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws CategoryNotFoundException
	 */
	public PlaceTO addRootPlace(String placeCode, String placeName, int categoryId) throws PlaceExistsException, CategoryNotFoundException;
	
	/**
	 * Method to add root place. All other places will be childs of this place
	 * 
	 * @param placeTO
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws CategoryNotFoundException
	 */
	public PlaceTO addRootPlace(PlaceTO placeTO) throws PlaceExistsException, CategoryNotFoundException;
	
	/**
	 * Method to add a place
	 * 
	 * @param placeTO
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws PlaceParentNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public PlaceTO addPlace(PlaceTO placeTO) throws PlaceExistsException, PlaceParentNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to add list of places
	 * 
	 * @param placeTOList
	 * @return List<PlaceTO>
	 * @throws PlaceExistsException
	 * @throws PlaceParentNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public List<PlaceTO> addPlaces(List<PlaceTO> placeTOList);
	
	/**
	 * Method to add list of places under a parent place
	 * 
	 * @param placeTOList
	 * @return List<PlaceTO>
	 * @throws PlaceExistsException
	 * @throws PlaceParentNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public List<PlaceTO> addPlaces(List<PlaceTO> placeTOList, PlaceTO parentPlace) throws PlaceParentNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to add place
	 * 
	 * @param placeName
	 * @param placeCode
	 * @param parentPlaceId
	 * @param categoryId
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws PlaceParentNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public PlaceTO addPlace(String placeName, String placeCode, int parentPlaceId, int categoryId) throws PlaceExistsException, PlaceParentNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to add a place
	 * 
	 * @param placeName
	 * @param placeCode
	 * @param parentPlaceCode
	 * @param categoryId
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws PlaceParentNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public PlaceTO addPlace(String placeName, String placeCode, String parentPlaceCode, int categoryId) throws PlaceExistsException, PlaceParentNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to add a place
	 * 
	 * @param placeName
	 * @param placeCode
	 * @param parentPlaceId
	 * @param categoryName
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws PlaceParentNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public PlaceTO addPlace(String placeName, String placeCode, int parentPlaceId, String categoryName) throws PlaceExistsException, PlaceParentNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to add a place
	 * 
	 * @param placeName
	 * @param placeCode
	 * @param parentPlaceCode
	 * @param categoryName
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws PlaceParentNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public PlaceTO addPlace(String placeName, String placeCode, String parentPlaceCode, String categoryName) throws PlaceExistsException, PlaceParentNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to modify a place name
	 * 
	 * @param placeId
	 * @param oldPlaceName
	 * @param newPlaceName
	 * @return
	 * @throws PlaceExistsException
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException 
	 */
	public PlaceTO modifyPlaceName(int placeId, String newPlaceName) throws PlaceExistsException, PlaceNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to modify a place name
	 * 
	 * @param placeCode
	 * @param oldPlaceName
	 * @param newPlaceName
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException 
	 */
	public PlaceTO modifyPlaceName(String placeCode, String newPlaceName) throws PlaceExistsException, PlaceNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to modify a place code
	 * 
	 * @param oldPlaceCode
	 * @param newPlaceCode
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException 
	 */
	public PlaceTO modifyPlaceCode(String oldPlaceCode, String newPlaceCode) throws PlaceExistsException, PlaceNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to modify a place which includes place name, place code, place parent
	 * 
	 * @param placeId
	 * @param newPlace
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException;
	 */
	public PlaceTO modifyPlace(int placeId, PlaceTO newPlace) throws PlaceExistsException, PlaceNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to modify a place which includes place name, place code, place parent and place category
	 * 
	 * @param placeCode
	 * @param newPlace
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public PlaceTO modifyPlace(String placeCode, PlaceTO newPlace) throws PlaceExistsException, PlaceNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to modify a place which includes place name, place code, place parent and place category
	 * 
	 * @param oldPlace
	 * @param newPlace
	 * @return PlaceTO
	 * @throws PlaceExistsException
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public PlaceTO modifyPlace(PlaceTO oldPlace, PlaceTO newPlace) throws PlaceExistsException, PlaceNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to modify a place category
	 * 
	 * @param placeId
	 * @param newCategoryId
	 * @return PlaceTO
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException
	 * @throws PlaceExistsException 
	 */
	public PlaceTO modifyPlaceCategory(int placeId, int newCategoryId) throws PlaceNotFoundException, CategoryNotFoundException, PlaceExistsException;
	
	/**
	 * Method to modify a place category
	 * 
	 * @param placeCode
	 * @param newCategoryId
	 * @return PlaceTO
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException
	 * @throws PlaceExistsException 
	 */
	public PlaceTO modifyPlaceCategory(String placeCode, int newCategoryId) throws PlaceNotFoundException, CategoryNotFoundException, PlaceExistsException;
	
	/**
	 * Method to modify a place category
	 * 
	 * @param placeId
	 * @param categoryName
	 * @return PlaceTO
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException
	 * @throws PlaceExistsException 
	 */
	public PlaceTO modifyPlaceCategory(int placeId, String categoryName) throws PlaceNotFoundException, CategoryNotFoundException, PlaceExistsException;
	
	/**
	 * Method to modify a place category
	 * 
	 * @param placeCode
	 * @param categoryName
	 * @return PlaceTO
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException
	 * @throws PlaceExistsException 
	 */
	public PlaceTO modifyPlaceCategory(String placeCode, String categoryName) throws PlaceNotFoundException, CategoryNotFoundException, PlaceExistsException;
	
	/**
	 * Method to modify a place parent
	 * 
	 * @param placeId
	 * @param parentPlaceId
	 * @return PlaceTO
	 * @throws PlaceNotFoundException
	 * @throws PlaceParentNotFoundException
	 */
	public PlaceTO modifyPlaceParent(int placeId, int parentPlaceId) throws PlaceNotFoundException, PlaceParentNotFoundException;
	
	/**
	 * Method to modify a place parent
	 * 
	 * @param placeCode
	 * @param parentPlaceId
	 * @return PlaceTO
	 * @throws PlaceNotFoundException
	 * @throws PlaceParentNotFoundException
	 */
	public PlaceTO modifyPlaceParent(String placeCode, int parentPlaceId) throws PlaceNotFoundException, PlaceParentNotFoundException;
	
	/**
	 * Method to modify a place parent
	 * 
	 * @param placeId
	 * @param parentPlaceCode
	 * @return PlaceTO
	 * @throws PlaceNotFoundException
	 * @throws PlaceParentNotFoundException
	 */
	public PlaceTO modifyPlaceParent(int placeId, String parentPlaceCode) throws PlaceNotFoundException, PlaceParentNotFoundException;
	
	/**
	 * Method to modify a place parent
	 * 
	 * @param placeCode
	 * @param parentPlaceCode
	 * @return PlaceTO
	 * @throws PlaceNotFoundException
	 * @throws PlaceParentNotFoundException
	 */
	public PlaceTO modifyPlaceParent(String placeCode, String parentPlaceCode) throws PlaceNotFoundException, PlaceParentNotFoundException;
	
	/**
	 * Method to remove a place
	 * 
	 * @param placeId
	 * @return boolean
	 * @throws PlaceNotFoundException
	 */
	public void removePlace(int placeId) throws PlaceNotFoundException;
	
	/**
	 * Method to remove a place
	 * 
	 * @param placeCode
	 * @return boolean
	 * @throws PlaceNotFoundException
	 */
	public void removePlace(String placeCode) throws PlaceNotFoundException;
	
	/**
	 * Method to get child places till the specified category like states in India, districts in India e.t.c
	 *  
	 * @param toCategoryId
	 * @param placeId
	 * @return List<PlaceTO>
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public List<PlaceTO> getPlaces(int toCategoryId, int placeId) throws PlaceNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to get child places till the specified category like states in India, districts in India e.t.c
	 * 
	 * @param toCategoryName
	 * @param placeId
	 * @return List<PlaceTO>
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public List<PlaceTO> getPlaces(String toCategoryName, int placeId) throws PlaceNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to get child places till the specified category like states in India, districts in India e.t.c
	 * 
	 * @param toCategoryId
	 * @param placeCode
	 * @return List<PlaceTO>
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public List<PlaceTO> getPlaces(int toCategoryId, String placeCode) throws PlaceNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to get child places till the specified category like states in India, districts in India e.t.c
	 * 
	 * @param toCategoryName
	 * @param placeCode
	 * @return List<PlaceTO>
	 * @throws PlaceNotFoundException
	 * @throws CategoryNotFoundException
	 */
	public List<PlaceTO> getPlaces(String toCategoryName, String placeCode) throws PlaceNotFoundException, CategoryNotFoundException;
	
	/**
	 * Method to get child places of a specified parent place
	 * 
	 * @param placeCode
	 * @return List<PlaceTO>
	 * @throws PlaceNotFoundException
	 */
	public List<PlaceTO> getPlaces(String placeCode) throws PlaceNotFoundException;
	
	/**
	 * Method to get child places of a specified parent place
	 * 
	 * @param placeId
	 * @return List<PlaceTO>
	 * @throws PlaceNotFoundException
	 */
	public List<PlaceTO> getPlaces(int placeId) throws PlaceNotFoundException;
	
	/**
	 * Method to get all places of specified category
	 * 
	 * @param categoryName
	 * @return List<PlaceTO>
	 * @throws CategoryNotFoundException
	 */
	public List<PlaceTO> getPlacesOfCategory(String categoryName) throws CategoryNotFoundException;
	
	/**
	 * Method to get all places of specified category
	 * 
	 * @param categoryId
	 * @return List<PlaceTO>
	 * @throws CategoryNotFoundException
	 */
	public List<PlaceTO> getPlacesOfCategory(int categoryId) throws CategoryNotFoundException;
	
}
